[SVM] Don't free HSA and root vmcb when disabling SVM
authorTim Deegan <Tim.Deegan@xensource.com>
Fri, 9 Mar 2007 11:45:19 +0000 (11:45 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Fri, 9 Mar 2007 11:45:19 +0000 (11:45 +0000)
since we're no longer allowed to free pages in an interrupt context.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/svm/vmcb.c
xen/include/asm-x86/hvm/svm/vmcb.h

index 61380c606aa036e13111b1f6a4a51adf0e59e0a5..0766ca5de21abf69fe28a452785f401124d0c076 100644 (file)
@@ -107,22 +107,10 @@ static inline void svm_inject_exception(struct vcpu *v, int trap,
 static void stop_svm(void)
 {
     u32 eax, edx;    
-    int cpu = smp_processor_id();
-
     /* We turn off the EFER_SVME bit. */
     rdmsr(MSR_EFER, eax, edx);
     eax &= ~EFER_SVME;
     wrmsr(MSR_EFER, eax, edx);
-    /* release the HSA */
-    free_host_save_area(hsa[cpu]);
-    hsa[cpu] = NULL;
-    wrmsr(MSR_K8_VM_HSAVE_PA, 0, 0 );
-
-    /* free up the root vmcb */
-    free_vmcb(root_vmcb[cpu]);
-    root_vmcb[cpu] = NULL;
-    root_vmcb_pa[cpu] = 0;
 }
 
 static void svm_store_cpu_guest_regs(
@@ -1058,8 +1046,9 @@ int start_svm(void)
         return 0;
     }
 
-    if (!(hsa[cpu] = alloc_host_save_area()))
-        return 0;
+    if (!hsa[cpu])
+        if (!(hsa[cpu] = alloc_host_save_area()))
+            return 0;
     
     rdmsr(MSR_EFER, eax, edx);
     eax |= EFER_SVME;
@@ -1074,8 +1063,9 @@ int start_svm(void)
     phys_hsa_hi = (u32) (phys_hsa >> 32);    
     wrmsr(MSR_K8_VM_HSAVE_PA, phys_hsa_lo, phys_hsa_hi);
   
-    if (!(root_vmcb[cpu] = alloc_vmcb())) 
-        return 0;
+    if (!root_vmcb[cpu])
+        if (!(root_vmcb[cpu] = alloc_vmcb())) 
+            return 0;
     root_vmcb_pa[cpu] = virt_to_maddr(root_vmcb[cpu]);
 
     if (cpu == 0)
index f2a220011e946460ec315f8a109dc81e35975df7..1d9c1569c3b6f46a88c834aa4a3313b54ffbac67 100644 (file)
@@ -79,11 +79,6 @@ struct host_save_area *alloc_host_save_area(void)
     return hsa;
 }
 
-void free_host_save_area(struct host_save_area *hsa)
-{
-    free_xenheap_page(hsa);
-}
-
 static int construct_vmcb(struct vcpu *v)
 {
     struct arch_svm_struct *arch_svm = &v->arch.hvm_svm;
index 8551e8a479962b03928c881f190f84ff2a8bf601..9dff3e65af6245d87c9fb6502dfb0794626fe8ea 100644 (file)
@@ -460,7 +460,6 @@ struct arch_svm_struct {
 struct vmcb_struct *alloc_vmcb(void);
 struct host_save_area *alloc_host_save_area(void);
 void free_vmcb(struct vmcb_struct *vmcb);
-void free_host_save_area(struct host_save_area *hsa);
 
 int  svm_create_vmcb(struct vcpu *v);
 void svm_destroy_vmcb(struct vcpu *v);